﻿-- ## core

create table [dbo].[core_user]
(
	[Id] uniqueidentifier primary key,
	[Account] nvarchar(32),
	[Name] nvarchar(32),
	[Email] nvarchar(32),
	[CreatedTime] datetime,
	[Prefix] nvarchar(32),
	[Password] nvarchar(32)
)
-- ## core_role
create table [dbo].[core_role]
(
	[Id] uniqueidentifier primary key,
	[Code] nvarchar(32),
	[Caption] nvarchar(32),
	[CreatedTime] datetime,
	[RefId] uniqueidentifier,
	[RefModule] nvarchar(32),
	[Type] nvarchar(32)
)


create TABLE [dbo].[wf_workflow]
(
	[Id] uniqueidentifier NOT NULL PRIMARY KEY,
	[Code] nvarchar(32) NOT NULL,
	[Caption] nvarchar(32)
)

create table [dbo].[wf_activity]
(
	[Id] uniqueidentifier not null primary key,
	[Code] nvarchar(32) not null,
	[WorkflowId] uniqueidentifier not null,
	[Caption] nvarchar(32),
	[IsInitial] bit
)

create table [dbo].[wf_event]
(
	[Id] uniqueidentifier not null primary key,
	[Code] nvarchar(32) not null,
	[WorkflowId] uniqueidentifier not null,
	[FromActivityId] uniqueidentifier not null,
	[ToActivityId] uniqueidentifier not null,
	[Caption] nvarchar(32),
	[IsNeedPickUser] bit,
	[IsNeedInputComment] bit
)